package handler

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/net/ghttp"
	"smart-health-platforms/demo/api/internal/logic"
	"smart-health-platforms/demo/api/internal/types"
)

// api层调用
func SendSms(r *ghttp.Request) {
	var req *types.SendSmsReq
	if err := r.Parse(&req); err != nil {
		r.Response.WriteJsonExit(g.Map{"error": err.Error()})
	}
	res, err := logic.SendSmsLogic(r.Context(), req)
	if err != nil {
		r.Response.WriteJsonExit(g.Map{"error": err.Error()})
	}
	r.Response.WriteJson(res)
}
